package com.ruoyi.teaching.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.teaching.mapper.TeachingClassesScheduleTemplateMapper;
import com.ruoyi.teaching.domain.TeachingClassesScheduleTemplate;
import com.ruoyi.teaching.service.ITeachingClassesScheduleTemplateService;
import com.ruoyi.common.core.text.Convert;

/**
 * 排课模板Service业务层处理
 *
 * @author William
 * @date 2022-10-19
 */
@Service
public class TeachingClassesScheduleTemplateServiceImpl implements ITeachingClassesScheduleTemplateService
{
    @Autowired
    private TeachingClassesScheduleTemplateMapper teachingClassesScheduleTemplateMapper;

    /**
     * 查询排课模板
     *
     * @param templateId 排课模板主键
     * @return 排课模板
     */
    @Override
    public TeachingClassesScheduleTemplate selectTeachingClassesScheduleTemplateByTemplateId(Long templateId)
    {
        return teachingClassesScheduleTemplateMapper.selectTeachingClassesScheduleTemplateByTemplateId(templateId);
    }

    /**
     * 查询排课模板列表
     *
     * @param teachingClassesScheduleTemplate 排课模板
     * @return 排课模板
     */
    @Override
    public List<TeachingClassesScheduleTemplate> selectTeachingClassesScheduleTemplateList(TeachingClassesScheduleTemplate teachingClassesScheduleTemplate)
    {
        return teachingClassesScheduleTemplateMapper.selectTeachingClassesScheduleTemplateList(teachingClassesScheduleTemplate);
    }

    /**
     * 新增排课模板
     *
     * @param teachingClassesScheduleTemplate 排课模板
     * @return 结果
     */
    @Override
    public int insertTeachingClassesScheduleTemplate(TeachingClassesScheduleTemplate teachingClassesScheduleTemplate)
    {
        teachingClassesScheduleTemplate.setCreateTime(DateUtils.getNowDate());
        return teachingClassesScheduleTemplateMapper.insertTeachingClassesScheduleTemplate(teachingClassesScheduleTemplate);
    }

    /**
     * 修改排课模板
     *
     * @param teachingClassesScheduleTemplate 排课模板
     * @return 结果
     */
    @Override
    public int updateTeachingClassesScheduleTemplate(TeachingClassesScheduleTemplate teachingClassesScheduleTemplate)
    {
        teachingClassesScheduleTemplate.setUpdateTime(DateUtils.getNowDate());
        return teachingClassesScheduleTemplateMapper.updateTeachingClassesScheduleTemplate(teachingClassesScheduleTemplate);
    }

    /**
     * 批量删除排课模板
     *
     * @param templateIds 需要删除的排课模板主键
     * @return 结果
     */
    @Override
    public int deleteTeachingClassesScheduleTemplateByTemplateIds(String templateIds)
    {
        return teachingClassesScheduleTemplateMapper.deleteTeachingClassesScheduleTemplateByTemplateIds(Convert.toStrArray(templateIds));
    }

    /**
     * 删除排课模板信息
     *
     * @param templateId 排课模板主键
     * @return 结果
     */
    @Override
    public int deleteTeachingClassesScheduleTemplateByTemplateId(Long templateId)
    {
        return teachingClassesScheduleTemplateMapper.deleteTeachingClassesScheduleTemplateByTemplateId(templateId);
    }
}
